package behaviours;

import core.Actuators;
import core.Senses;

public class ExploreRoom extends Behaviour {

	private FollowWall followWall = new FollowWall();
	private Turn turn = new Turn();
	
	@Override
	protected boolean isFinished() {
		Actuators.setMotors(0, 0);
		Senses.readGround();
		return Senses.isOnGround();
	}
	float x = 1;
	@Override
	protected void loop() throws InterruptedException {
		followWall.execute();
		Senses.readProximity();
		if(Senses.getProximity(3) > 550 ){
			while(Senses.getProximity(5) < 800 ){
				Actuators.setMotors(5, -5);
				Thread.sleep(130);
				Senses.readProximity();
			}
		}else{
			while(Senses.getProximity(5) < 800 ){
				Actuators.setMotors(5, 2);
				Thread.sleep(130);
				Senses.readProximity();
			}
		}
	}

}
